package com.yunao.commons.serachcore.core.bean;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

public class Cluster implements Serializable {

	private static final long serialVersionUID = 1L;

	private int wordLimit;
	private int wordNum;
	private List<String> words;

	private double docPercent;
	private double docRadio;
	private List<Article> docs;

	public int getWordLimit() {
		return wordLimit;
	}

	public void setWordLimit(int wordLimit) {
		this.wordLimit = wordLimit;
	}

	public int getWordNum() {
		return wordNum;
	}

	public void setWordNum(int wordNum) {
		this.wordNum = wordNum;
	}

	public List<String> getWords() {
		return words;
	}

	public void setWords(List<String> words) {
		this.words = words;
	}

	public double getDocPercent() {
		return docPercent;
	}

	public void setDocPercent(double docPercent) {
		this.docPercent = docPercent;
	}

	public double getDocRadio() {
		return docRadio;
	}

	public void setDocRadio(double docRadio) {
		this.docRadio = docRadio;
	}

	public List<Article> getDocs() {
		if (docs == null) {
			docs = Collections.emptyList();
		}
		return docs;
	}

	public void setDocs(List<Article> docs) {
		this.docs = docs;
	}
	
	@Override
	public String toString() {
		StringBuilder res = new StringBuilder(String.valueOf(words));
		if (docs != null && !docs.isEmpty()) {
			for (Article doc : docs) {
				res.append("\n\t").append(doc);
			}
		}
		return res.toString();
	}

}
